<include file="header" />
<body>
<div class="wraper">
	<div class="head clearfix">
		<a href="{BEESCRM::U('base/water/index',array('water_id' => $water_id))}" class="iconfont icon-fanhui72 pull-left"></a>
		<span class="head-name pull-left">订桶装水</span>
		<a href="{BEESCRM::U('base/water/index',array('water_id' => $water_id))}" class="pull-left text-right"><span class="iconfont icon-fangzi"></span></a>
	</div>
	<div class="express">
		<div class="logistics">
			<volist name="data" id="vo">
				<div class="logistics-list">
					<div class="list-text">
						<div class="tb-mode">
                            <if condition="$vo['snack_arr']">
                                <div class="tb-cell">
                                    <p class="time">{BEESCRM:$vo.pay_time|date="Y-m-d",###}</p>
                                    <p class="stress">{BEESCRM:$vo.goods_name}（{BEESCRM:$vo.goods_price}元）*{BEESCRM:$vo.goods_num}</p>
                                    <volist name="vo.snack_arr" id="vol">
                                        <p class="stress">{BEESCRM:$vol.snack_name}（{BEESCRM:$vol.price}元）*{BEESCRM:$vol.snack_num}</p>
                                    </volist>
                                    <p>合计：{BEESCRM:$vo.order_amount}元</p>
                                    <p>{BEESCRM:$vo.address}</p>
                                </div>
                                <else />
                                <div class="tb-cell">
                                    <p class="time">{BEESCRM:$vo.pay_time|date="Y-m-d",###}</p>
                                    <p class="stress">{BEESCRM:$vo.goods_name}（{BEESCRM:$vo.goods_price}元）*{BEESCRM:$vo.goods_num}</p>
                                    <p>合计：{BEESCRM:$vo.order_amount}元</p>
                                    <p>{BEESCRM:$vo.address}</p>
                                </div>
                            </if>
							<if condition="$vo['status'] eq 1">
								<div class="tb-cell text-right vertical-top">
									<span class="text-red status">待配送</span>
								</div>
							</if>

							<if condition="$vo['status'] eq 2">
								<div class="tb-cell text-right vertical-top">
									<span class="text-green status">派送中</span>
								</div>
							</if>

							<if condition="$vo['status'] eq 3">
								<div class="tb-cell text-right">
									<a href="javascript:void(0);" class="status-btn green-btn rec" data-id="{BEESCRM:$vo.order_id}">确认收货</a>
								</div>
							</if>

							<if condition="$vo['status'] eq 4">
								<div class="tb-cell text-right">
								<a href="javascript:void(0);" class="status-btn orange-btn pingjia" data-id="{BEESCRM:$vo.order_id}">评价</a>
								</div>
							</if>

							<if condition="$vo['status'] eq 5">
								<div class="tb-cell text-right vertical-top">
									<span class="text-green status">已完成</span>
								</div>
							</if>

						</div>
						<p class="comment-text">{BEESCRM:$vo.comment}</p>
					</div>
					<span class="circle"></span>
				</div>
			</volist>
		</div>
		<p class="copyright">技术支持 杭州青橄榄网络技术有限公司</p>
	</div>
</div>

<div class="pop-box comment-box">
	<div class="main">
		<p class="pop-list text-center">评价<span class="iconfont icon-guanbi close pull-right"></span></p>
		<div class="pop-list clearfix">
			<p class="check-list checked" data-content="非常满意"><span class="iconfont icon-xuanzedianjihou"></span>非常满意</p>
			<p class="check-list" data-content="满意"><span class="iconfont icon-xuanzedianjihou"></span>满意</p>
			<p class="check-list" data-content="不满意"><span class="iconfont icon-xuanzedianjihou"></span>不满意</p>
		</div>
		<div class="block-space">
			<textarea maxlength="20" placeholder="请详细描述，不超过20个中文汉字" name="content" id="content"></textarea>
		</div>
		<div class="pop-btn">
			<input type="hidden" id="order_id">
			<a href="javascript:void(0);" id="up">确认提交</a>
		</div>
	</div>
</div>

<include file="commonJs" />
<script>
	var swiper = new Swiper('.banner .swiper-container', {
		pagination: '.banner .swiper-pagination',
		paginationClickable: true,
		spaceBetween: 30,
		centeredSlides: true,
		autoplay: 2500,
		autoplayDisableOnInteraction: false
	});
	$(function(){
		var height = $(document).height();
		var height_head = $('.head').outerHeight();
		var height_banner = $('.banner').outerHeight();
		var contain_h = height - height_head - height_banner;
		$('.logistics').css("minHeight",contain_h);
	});
	
	var waterId = "{BEESCRM:$water_id}";
	
	$('.rec').on('click',function(){
		var order_id = $(this).data('id');
		$.confirm('确认收货吗？', drop);
		function drop() {
			var json = {},data = {};
			data.id = order_id;
			json.data = data;
			json.url = '/base/water/confirmReceipt/water_id/'+waterId;
			json.method = 'post';
			json.type = 'json';
			$.getAjax(json, true, reload, '');
		}
	});

	//页面刷新
	function reload(data){
		$('.pop-box').hide();
		setTimeout('location.reload()', 2000);
	}

	$(function(){
		$('.pingjia').click(function(){
			var order_id = $(this).data('id');
			$('#order_id').val(order_id);
			$('.comment-box').show();
		});
		
		$('.close').click(function(){
			$('.pop-box').hide();
		});
		
		$('.pop-list').on('click','.check-list',function(){
			$(this).toggleClass('checked').siblings().removeClass('checked');
		});

		$('#up').on('click',function(){
			var info = $('.checked').data('content');
			var content = $('#content').val();
			var order_id = $('#order_id').val();
			var json = {},data = {};
			data.id = order_id;
			data.info = info;
			data.content = content;
			json.data = data;
			json.url = '/base/water/commentOrder/water_id/'+waterId;
			json.method = 'post';
			json.type = 'json';
			$.getAjax(json, true, reload, '');
		});
	})
</script>
</body>
</html>
